import 'package:flutter/material.dart';

class JobDetailPage extends StatelessWidget {
  const JobDetailPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      // appBar: AppBar(
      //   actions: [IconButton(icon: const Icon(Icons.close), onPressed: () {})],
      // ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          _buildTitleSection(),
          const SizedBox(height: 16),
          _buildSalary(),
          const SizedBox(height: 24),
          _buildCompanyInfo(),
          const SizedBox(height: 20),
          _buildRequirements(),
          const SizedBox(height: 20),
          _buildTags(),
          const Spacer(),
          _buildFooter(),
          const SizedBox(height: 20),
        ],
      ),
    );
  }

  Widget _buildTitleSection() => const Text(
    "Android",
    style: TextStyle(
      fontSize: 24,
      fontWeight: FontWeight.w600,
      color: Colors.black87,
    ),
  );

  Widget _buildSalary() => const Text(
    "12-20K",
    style: TextStyle(
      fontSize: 20,
      fontWeight: FontWeight.w500,
      color: Color(0xFFF57C00),
    ),
  );

  Widget _buildCompanyInfo() => Column(
    crossAxisAlignment: CrossAxisAlignment.start,
    children: [
      RichText(
        text: const TextSpan(
          style: TextStyle(color: Colors.grey, fontSize: 15),
          children: [
            TextSpan(
              text: "万禾科技",
              style: TextStyle(color: Colors.black87),
            ),
            TextSpan(text: " · "),
            TextSpan(text: "未融资"),
            TextSpan(text: " · "),
            TextSpan(text: "20-99人"),
          ],
        ),
      ),
      const SizedBox(height: 12),
      _buildInfoRow(Icons.work_outline, "5-10年"),
      const SizedBox(height: 8),
      _buildInfoRow(Icons.school_outlined, "学历不限"),
    ],
  );

  Widget _buildInfoRow(IconData icon, String text) => Row(
    children: [
      Icon(icon, size: 20, color: Colors.grey),
      const SizedBox(width: 8),
      Text(text, style: const TextStyle(fontSize: 15)),
    ],
  );

  Widget _buildRequirements() => const Column(
    crossAxisAlignment: CrossAxisAlignment.start,
    children: [
      Text("职位要求", style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500)),
      SizedBox(height: 12),
      // 这里可以添加更多具体要求条目
    ],
  );

  Widget _buildTags() => Wrap(
    spacing: 8,
    runSpacing: 8,
    children: ["SDK", "UI", "原生android"]
        .map((tag) => Container(
      padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
      decoration: BoxDecoration(
        color: Colors.grey[200],
        borderRadius: BorderRadius.circular(16),
      ),
      child: Text(tag, style: const TextStyle(fontSize: 13)),
    ))
        .toList(),
  );

  Widget _buildFooter() => Row(
    mainAxisAlignment: MainAxisAlignment.spaceBetween,
    children: [
      const Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Text("李先生·经理", style: TextStyle(fontSize: 13)),
          SizedBox(height: 4),
          Text("今日回复6次",
              style: TextStyle(fontSize: 12, color: Colors.grey)),
        ],
      ),
      Row(
        children: [
          const Text("相城区开发区",
              style: TextStyle(fontSize: 13, color: Colors.grey)),
          const SizedBox(width: 8),
          Icon(Icons.location_on_outlined, size: 18, color: Colors.grey[600]),
        ],
      )
    ],
  );
}